package com.zeng.service.impl;

import com.zeng.entity.Ordersinfo;
import com.zeng.dao.OrdersinfoDao;
import com.zeng.service.OrdersinfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Ordersinfo)表服务实现类
 *
 * @author zengfanchao
 * @since 2021-03-30 14:51:47
 */
@Service("ordersinfoService")
public class OrdersinfoServiceImpl implements OrdersinfoService {
    @Resource
    private OrdersinfoDao ordersinfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param orderid 主键
     * @return 实例对象
     */
    @Override
    public Ordersinfo queryById(Integer orderid) {
        return this.ordersinfoDao.queryById(orderid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<Ordersinfo> queryAllByLimit(int offset, int limit) {
        return this.ordersinfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param ordersinfo 实例对象
     * @return 实例对象
     */
    @Override
    public Ordersinfo insert(Ordersinfo ordersinfo) {
        this.ordersinfoDao.insert(ordersinfo);
        return ordersinfo;
    }

    /**
     * 修改数据
     *
     * @param ordersinfo 实例对象
     * @return 实例对象
     */
    @Override
    public Ordersinfo update(Ordersinfo ordersinfo) {
        this.ordersinfoDao.update(ordersinfo);
        return this.queryById(ordersinfo.getOrderid());
    }

    /**
     * 通过主键删除数据
     *
     * @param orderid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer orderid) {
        return this.ordersinfoDao.deleteById(orderid) > 0;
    }

    @Override
    public List<Ordersinfo> selectAll() {
        return this.ordersinfoDao.selectAll();
    }

    @Override
    public int queryCount() {
        return this.ordersinfoDao.queryCount();
    }

    @Override
    public int queryCountSelect(String key) {
        return this.ordersinfoDao.queryCountSelect(key);
    }

    @Override
    public List<Ordersinfo> queryKeyByLimit(String key, Integer offset, Integer limit) {
        return this.ordersinfoDao.queryKeyByLimit(key, offset, limit);
    }

    @Override
    public List<Ordersinfo> queryAll(Ordersinfo ordersinfo) {
        return this.ordersinfoDao.queryAll(ordersinfo);
    }

}
